<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>&nbsp;</title>
    </head>
    <body>
        <#if grade??>
         <form id="fm" method="post" action="app/grade/update">
         <input type="hidden" id="id" name="id" value="${(grade.id)!}">
         <input type="hidden" id="type" name="type" value="0">
        <#else>
         <form id="fm" method="post" action="app/grade/add">
         <input type="hidden" id="type" name="type" value="0">
        </#if>
        
         <div style="margin-bottom:10px">
                        <input id="adot" class="easyui-numberbox" max="99999999999" size="18" maxlength="18" name="adot" style="width:100%" value="${(grade.adot)!}" data-options="label:'从档:',required:true,min:0,precision:0,groupSeparator:',',decimalSeparator:'.'">
                </div>
                
                <div style="margin-bottom:10px">
                        <input id="bdot" class="easyui-numberbox" max="99999999999" size="18" maxlength="18" name="bdot" style="width:100%" value="${(grade.bdot)!}" data-options="label:'终档:',required:true,min:0,precision:0,groupSeparator:',',decimalSeparator:'.'">
                </div>
                <div style="margin-bottom:10px">
                        <input id="bonus_rate" class="easyui-numberbox" max="99.99" size="5" maxlength="5" name="bonus_rate" style="width:100%" value="${(grade.bonus_rate)!}"  data-options="label:'百分比:',required:true,min:0,precision:2,groupSeparator:',',decimalSeparator:'.'">
                </div>
                <div style="margin-bottom:10px">
                        <input id="opt" class="easyui-textbox" name="opt" style="width:100%" value="${(grade.opt)!}" data-options="label:'备注:',required:false">
                </div>
        </form>
        <div style="text-align:center;padding:5px">
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()" style="width:80px">保存</a>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <#if grade??>
                <a href="javascript:void(0)" class="easyui-linkbutton" onclick="closeForm()" style="width:80px">关闭</a>
            <#else> 
                <a href="javascript:void(0)" class="easyui-linkbutton" onclick="clearForm()" style="width:80px">重置</a>
            </#if>
        </div>
       
       <script type="text/javascript">
            function submitForm(){
            	var url='app/grade/update';
            	if(!$('#id').val()){
            		url='app/grade/add';
            	}
            	$.post(url,{
            		id:$('#id').val(),
            		type:0,
            		adot:$('#adot').val(),
            		bdot:$('#bdot').val(),
            		bonus_rate:$('#bonus_rate').val(),
            		opt:$('#opt').val()
            	},function(r){
            		if(r>0){
            			window.parent.tips(r.desc)
            		}
            		$('#form').dialog('close');
            	},'json')
            	
                /* $('#fm').form('submit',{
                	success:function(){
                		$('#form').dialog('close');
                	}
                }); */
            }
            function clearForm(){
                $('#fm').form('clear');
            }
            function closeForm(){
            	$('#form').dialog('close');
            }
       </script>
    
     </body>
</html>